﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="HeadStyles" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadScripts" runat="server">
  <script type="text/javascript" src="/Scripts/m-former.js"></script>   
  <script type="text/javascript" src="/Scripts/formvalidator/formValidator-4.1.1.js"></script>
<script type="text/javascript" src="/Scripts/formvalidator/formValidatorRegex.js"></script> 
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
  <% AdminUserModel AdminUser = ViewData["AdminUser"] as AdminUserModel; %>

<div class="pd10">
       <form id="form1" action="Update" method="post">
		<table class="tb-list mt10">
			<tr>
				<td class="aR" style="width:150px;">*用戶名：</td>
				<td class="aL">
				   <%=(AdminUser!=null)?AdminUser.UserName:"" %>
				    
				</td>
                <td  class="aL" style="width:40%;">
                    <div id="txtUserNameTip"></div>
                 </td>
			</tr>
            <tr>
				<td class="aR" style="width:150px;">*姓名 ：</td>
				<td class="aL">
				    <input type="text" id="txtTrueName" name="txtTrueName" value="<%=(AdminUser!=null)?AdminUser.TrueName:"" %>" class="inputStyle"/>
				</td>
                <td class="aL">
                <div id="txtTrueNameTip"></div>
                </td>
			</tr>
                <tr>
				<td class="aR" style="width:150px;">*邮箱 ：</td>
				<td class="aL">
				    <input type="text" id="txtEMail" name="txtEMail" value="<%=(AdminUser!=null)?AdminUser.EMail:"" %>" class="inputStyle"/>
				</td>
                <td class="aL">
                <div id="txtEMailTip"></div>
                </td>
			</tr>
              <tr>
				<td class="aR" style="width:150px;">*电话 ：</td>
				<td class="aL">
				    <input type="text" id="txtTelephone" name="txtTelephone" value="<%=(AdminUser!=null)?AdminUser.Telephone:"" %>" class="inputStyle"/>
				</td>
                 <td class="aL">
                <div id="txtTelephoneTip"></div>
                </td>
			</tr>
            </tr>

			<tr>
				<td class="aR">*所属部门：</td>
				<td class="aL"><select id="sltOrg" name="sltOrg">
                        <% IList<OrganizationModel> OrganizationList = ViewData["OrganizationList"] as List<OrganizationModel>; %>
						<%foreach (OrganizationModel c in OrganizationList)%>
						<%{%>
							<% if (AdminUser != null && c.OrgID == AdminUser.OrgID) %>
							<%{%>
								<option value="<%=c.OrgID %>" selected="selected"><%=c.OrgName%></option>
							<%}%>
							<%else %>
							<%{ %>
								<option value="<%=c.OrgID %>"><%=c.OrgName%></option>
							<%} %>
						<%}%>
				   </select></td>
                    <td class="aL">
                    <div id="sltOrgTip"></div>
                   </td>
			</tr>
                            <tr>
				<td class="aR" style="width:150px;">*备注 ：</td>
				<td class="aL">
                    <textarea id="txtMemo" name="txtMemo" cols="20" rows="5"  style="width:150px"><%=(AdminUser!=null)?AdminUser.Memo:"" %></textarea>
				</td>
                 <td class="aL">
                <div id="txtMemoTip"></div>
                </td>
			</tr>
		</table>
	    <div class="mt10 aC">
	        <input type="hidden" name="hdUserID" value="<%=(AdminUser!=null)?AdminUser.UserID.ToString():"" %>" />     
            <input id="subbtn" type="submit" value="保存" class="i-btn3"/>
            <input type="button" value="取消" onclick="cancel();" class="i-btn3"/>
	    </div>

    </form>
</div>

</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="BodyScripts" runat="server">
<script type="text/javascript">
    $(document).ready(function () {
        $.formValidator.initConfig({ formID: "form1", theme: "SolidBox", submitOnce: true,
            onError: function (msg, obj, errorlist) {
                $("#errorlist").empty();
                $.map(errorlist, function (msg) {
                    $("#errorlist").append("<li>" + msg + "</li>")
                });
                alert(msg);
            },
            ajaxPrompt: '正在异步验证，请稍等...'
        });
        $("#txtTrueName").formValidator({ onShow: "请输入真实姓名", onFocus: "姓名4-12个字符", onCorrect: "正确" }).inputValidator({ min: 4, max: 8, onError: "长度非法" });
        $("#txtEMail").formValidator({ onShow: "请输入邮箱", onFocus: "邮箱6-100个字符", onCorrect: "正确" }).inputValidator({ min: 2, max: 100, onError: "长度非法" });
        $("#txtTelephone").formValidator({ onShow: "请输入电话号码", onFocus: "电话6-100个字符", onCorrect: "正确" }).inputValidator({ min: 6, max: 100, onError: "长度非法" });
        $("#txtMemo").formValidator({ onShow: "请输入备注", onFocus: "备注0-100个字符", onCorrect: "正确" }).inputValidator({ min: 0, max: 100, onError: "长度非法" });
        $("#sltOrg").formValidator({ onShow: "请选择所属部门", onFocus: "部门必须选择", onCorrect: "正确" }).inputValidator({ min: 1, onError: "请选择部门!" }).defaultPassed();

    });

    function cancel() {
        window.top.oDG.cancel();
    };

    function successHandle() {
        window.top.winObj.refresh();
        window.top.oDG.cancel();
    };
</script>
</asp:Content>
